<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>Array objects &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script type="text/javascript" src="../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../about.html" >
    <link rel="index" title="Index" href="../genindex.html" >
    <link rel="search" title="Search" href="../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../index.html" >
    <link rel="up" title="NumPy Reference" href="index.html" >
    <link rel="next" title="The N-dimensional array (ndarray)" href="arrays.ndarray.html" >
    <link rel="prev" title="NumPy Reference" href="index.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../index.html">
      <img border=0 alt="NumPy" src="../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="index.html" accesskey="U">NumPy Reference</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="arrays.ndarray.html" title="The N-dimensional array (ndarray)"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="index.html" title="NumPy Reference"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">NumPy Reference</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="arrays.ndarray.html"
                        title="next chapter">The N-dimensional array (<code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code>)</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <div class="section" id="array-objects">
<span id="arrays"></span><h1>Array objects<a class="headerlink" href="#array-objects" title="Permalink to this headline">¶</a></h1>
<p>NumPy provides an N-dimensional array type, the <a class="reference internal" href="arrays.ndarray.html#arrays-ndarray"><span class="std std-ref">ndarray</span></a>, which describes a collection of “items” of the same
type. The items can be <a class="reference internal" href="arrays.indexing.html#arrays-indexing"><span class="std std-ref">indexed</span></a> using for
example N integers.</p>
<p>All ndarrays are <a class="reference internal" href="../glossary.html#term-homogenous"><span class="xref std std-term">homogenous</span></a>: every item takes up the same size
block of memory, and all blocks are interpreted in exactly the same
way. How each item in the array is to be interpreted is specified by a
separate <a class="reference internal" href="arrays.dtypes.html#arrays-dtypes"><span class="std std-ref">data-type object</span></a>, one of which is associated
with every array. In addition to basic types (integers, floats,
<em>etc.</em>), the data type objects can also represent data structures.</p>
<p>An item extracted from an array, <em>e.g.</em>, by indexing, is represented
by a Python object whose type is one of the <a class="reference internal" href="arrays.scalars.html#arrays-scalars"><span class="std std-ref">array scalar types</span></a> built in NumPy. The array scalars allow easy manipulation
of also more complicated arrangements of data.</p>
<div class="figure align-default" id="id1">
<img alt="../_images/threefundamental.png" src="../_images/threefundamental.png" />
<p class="caption"><span class="caption-text"><strong>Figure</strong>
Conceptual diagram showing the relationship between the three
fundamental objects used to describe the data in an array: 1) the
ndarray itself, 2) the data-type object that describes the layout
of a single fixed-size element of the array, 3) the array-scalar
Python object that is returned when a single element of the array
is accessed.</span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</div>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="arrays.ndarray.html">The N-dimensional array (<code class="xref py py-class docutils literal notranslate"><span class="pre">ndarray</span></code>)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.ndarray.html#constructing-arrays">Constructing arrays</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.ndarray.html#indexing-arrays">Indexing arrays</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.ndarray.html#internal-memory-layout-of-an-ndarray">Internal memory layout of an ndarray</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.ndarray.html#array-attributes">Array attributes</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.ndarray.html#array-methods">Array methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.ndarray.html#arithmetic-matrix-multiplication-and-comparison-operations">Arithmetic, matrix multiplication, and comparison operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.ndarray.html#special-methods">Special methods</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="arrays.scalars.html">Scalars</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.scalars.html#built-in-scalar-types">Built-in scalar types</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.scalars.html#attributes">Attributes</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.scalars.html#indexing">Indexing</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.scalars.html#methods">Methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.scalars.html#defining-new-types">Defining new types</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="arrays.dtypes.html">Data type objects (<code class="xref py py-class docutils literal notranslate"><span class="pre">dtype</span></code>)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.dtypes.html#specifying-and-constructing-data-types">Specifying and constructing data types</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.dtypes.html#dtype"><code class="xref py py-class docutils literal notranslate"><span class="pre">dtype</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="arrays.indexing.html">Indexing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.indexing.html#basic-slicing-and-indexing">Basic Slicing and Indexing</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.indexing.html#advanced-indexing">Advanced Indexing</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.indexing.html#detailed-notes">Detailed notes</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.indexing.html#field-access">Field Access</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.indexing.html#flat-iterator-indexing">Flat Iterator indexing</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="arrays.nditer.html">Iterating Over Arrays</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.nditer.html#single-array-iteration">Single Array Iteration</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.nditer.html#broadcasting-array-iteration">Broadcasting Array Iteration</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.nditer.html#putting-the-inner-loop-in-cython">Putting the Inner Loop in Cython</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="arrays.classes.html">Standard array subclasses</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#special-attributes-and-methods">Special attributes and methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#matrix-objects">Matrix objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#memory-mapped-file-arrays">Memory-mapped file arrays</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#character-arrays-numpy-char">Character arrays (<code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.char</span></code>)</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#record-arrays-numpy-rec">Record arrays (<code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.rec</span></code>)</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#masked-arrays-numpy-ma">Masked arrays (<code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.ma</span></code>)</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#standard-container-class">Standard container class</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.classes.html#array-iterators">Array Iterators</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="maskedarray.html">Masked arrays</a><ul>
<li class="toctree-l2"><a class="reference internal" href="maskedarray.generic.html">The <code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.ma</span></code> module</a></li>
<li class="toctree-l2"><a class="reference internal" href="maskedarray.generic.html#using-numpy-ma">Using numpy.ma</a></li>
<li class="toctree-l2"><a class="reference internal" href="maskedarray.generic.html#examples">Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="maskedarray.baseclass.html">Constants of the <code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.ma</span></code> module</a></li>
<li class="toctree-l2"><a class="reference internal" href="maskedarray.baseclass.html#the-maskedarray-class">The <code class="xref py py-class docutils literal notranslate"><span class="pre">MaskedArray</span></code> class</a></li>
<li class="toctree-l2"><a class="reference internal" href="maskedarray.baseclass.html#maskedarray-methods"><code class="xref py py-class docutils literal notranslate"><span class="pre">MaskedArray</span></code> methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="routines.ma.html">Masked array operations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="arrays.interface.html">The Array Interface</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.interface.html#python-side">Python side</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.interface.html#c-struct-access">C-struct access</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.interface.html#type-description-examples">Type description examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.interface.html#differences-with-array-interface-version-2">Differences with Array interface (Version 2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="arrays.datetime.html">Datetimes and Timedeltas</a><ul>
<li class="toctree-l2"><a class="reference internal" href="arrays.datetime.html#basic-datetimes">Basic Datetimes</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.datetime.html#datetime-and-timedelta-arithmetic">Datetime and Timedelta Arithmetic</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.datetime.html#datetime-units">Datetime Units</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.datetime.html#business-day-functionality">Business Day Functionality</a></li>
<li class="toctree-l2"><a class="reference internal" href="arrays.datetime.html#changes-with-numpy-1-11">Changes with NumPy 1.11</a></li>
</ul>
</li>
</ul>
</div>
</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>